import axios from '@/util/axios';
const message = {
    namespaced: true,
    state: {
        messageNumber: {
            unreadCount: '',
            readCount: '',
            allCount: ''
        }
    },
    // 衍生属性
    getters: {
        getMessageNumber(state: any) {
            return state.messageNumber
        }
    },
    // 更改数据
    mutations: {
        setMessageNumber(state: any, messageNumber: any) {
            state.messageNumber = messageNumber;
        }
    },
    // 异步操作
    actions: {
        async getMessageNumber (store: any) {
            let res = await axios.get('notis/notification/statistics')
            store.commit('setMessageNumber', res.data)
        }
    }
}

export default message;